import java.util.Scanner;

public class text31 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
        System.out.println("--------0.退出--------");
        System.out.println("------1.计算面积-----");
        System.out.println("------2.计算体积----");
        System.out.print("请选择->");
        int num1 = sc.nextInt();
            if(num1 == 1){
                System.out.println("1.计算正方形的面积");
                System.out.println("2.计算长方形的面积");
                System.out.println("3.计算梯形的面积");
                System.out.println("4.计算圆形的面积");
                System.out.print("请选择->");
                int num2 = sc.nextInt();
                switch(num2){
                    case 1:
                        System.out.print("输入正方形的边长");
                        int a = sc.nextInt();
                        area(a);
                        break;
                    case 2:
                        System.out.print("输入长方形的长->");
                        int a1 = sc.nextInt();
                        System.out.print("输入长方形的宽->");
                        int b1 = sc.nextInt();
                        area(a1,b1);
                        break;
                    case 3:
                        System.out.print("输入梯形的上底->");
                        int a2 = sc.nextInt();
                        System.out.print("输入梯形的下底->");
                        int b2 = sc.nextInt();
                        System.out.print("输入梯形的高");
                        int h1 = sc.nextInt();
                        area(a2,b2,h1);
                        break;
                    case 4:
                        System.out.println("输入圆形的半径");
                        double a3 = sc.nextDouble();
                        area(a3);
                        break;
                    default:
                        System.out.println("选择错误");
                }
            }else if(num1 == 2){
                System.out.println("1.计算正方体的体积");
                System.out.println("2.计算长方体的体积");
                System.out.println("3.计算柱体的体积");
                System.out.println("4.计算圆的体积");
                System.out.print("请选择->");
                int num2 = sc.nextInt();
                switch(num2){
                    case 1:
                        System.out.print("输入正方体的边长");
                        int a = sc.nextInt();
                        volume(a);
                        break;
                    case 2:
                        System.out.print("输入长方体的长->");
                        int a1 = sc.nextInt();
                        System.out.print("输入长方体的宽->");
                        int b1 = sc.nextInt();
                        System.out.print("输入长方体的高->");
                        int h1 = sc.nextInt();
                        volume(a1,b1,h1);
                        break;
                    case 3:
                        System.out.print("输入梯体的底面半径->");
                        int b2 = sc.nextInt();
                        System.out.print("输入梯体的高");
                        int h2 = sc.nextInt();
                        volume(b2,h2);
                        break;
                    case 4:
                        System.out.print("输入圆的半径");
                        double a3 = sc.nextDouble();
                        volume(a3);
                        break;
                    default:
                        System.out.println("选择错误");
                }
            }else if(num1 == 0){
                break;
            }
            else{
                System.out.println("选择错误");
            }
        }
    }

    private static void volume(double a3) {
        System.out.println("圆的体积为"+4/3*3.14*a3 * a3 * a3);
    }

    private static void volume(int b2, int h2) {
        System.out.println("柱体的体积为" + 3.14 * b2 * b2 *  h2);
    }

    private static void volume(int a1, int b1, int h1) {
        System.out.println("长方体的体积为" + a1 * b1 * h1);
    }

    private static void volume(int a) {
        System.out.println("正方体体积为" + a * a * a);
    }

    private static void area(double a3) {
        System.out.println("圆形的面积为" +  3.14 * a3 * a3);

    }

    private static void area(int a2, int b2, int h1) {
        System.out.println("梯形的面积为" +  (a2 + b2) * h1 / 2);
    }

    private static void area(int a1, int b1) {
        System.out.println("长方形的面积为" + a1 * b1);
    }

    private static void area(int a) {
        System.out.println("正方形面积为" + a * a);
    }
}


